#! /bin/sh
# MakeData - Generate a three-component dataset for demo scripts
#            Supolar, Supofilt, and Sueipofi
# Author:    Nils Maercklin, GFZ Potsdam, Germany, 2001 
#
# Notes:
# It is not necessary to run this script prior to one of the demo scripts
# named above. It will be called automatically, if it is in the same working 
# directory as the demo scripts.
# 
# Each of the generated seismic arrivals have different polarization 
# properties, which can be changed by editing the amplitude value(s) for one 
# or more components of the corresponding reflector ("ref=AMP:..."). See 
# selfdoc of susynlv for details. 
# The output file "data3c.su" is station-sorted (Z, H1, H2, Z, H1, H2,...).
#
# The generated dataset is for demonstration purposes only. It does not 
# represent a seismogram of any physical earth model.

# Signal-to-noise ratio of generated data:
sn=10


# Create a dataset, which looks like three-component seismics:

echo "Create three-component demonstration data"
echo " type:   sukeyword trid      to see list of possible trace id values"

# Vertical component:
susynlv nxo=20 nxs=1 fxo=1.0 dt=0.004 nt=701 fpeak=12 \
  ref="1:0,0.5;2,0.5" \
  ref="1:0,0.8;2,1.0" \
  ref="-1.7:0,1.0;2,1.0" \
  ref="0:0,1.4;2,1.2" \
  ref="0.5:0,1.8;2,1.8" \
  ref="0.5:0,2.0;2,2.4" \
  ref="1.8:0,2.1;2,2.4" |
sushw key=trid a=12 > temp.su

# Horizontal component 1:
susynlv nxo=20 nxs=1 fxo=1.0 dt=0.004 nt=701 fpeak=12 \
  ref="0:0,0.5;2,0.5" \
  ref="1:0,0.8;2,1.0" \
  ref="1:0,1.0;2,1.0" \
  ref="1.7:0,1.4;2,1.2" \
  ref="-2:0,1.8;2,1.8" \
  ref="1:0,2.0;2,2.4" \
  ref="2:0,2.1;2,2.4" |
sushw key=trid a=13 >> temp.su

# Horizontal component 2:
susynlv nxo=20 nxs=1 fxo=1.0 dt=0.004 nt=701 fpeak=12 \
  ref="0:0,0.5;2,0.5" \
  ref="1:0,0.8;2,1.0" \
  ref="0:0,1.0;2,1.0" \
  ref="1:0,1.4;2,1.2" \
  ref="-2:0,1.8;2,1.8" \
  ref="-2:0,2.0;2,2.4" \
  ref="2:0,2.1;2,2.4" |
sushw key=trid a=14 >> temp.su




# Add noise and sort by key header word tracf:

echo "Add noise with S/N=$sn and sort by tracf and trid"

suaddnoise <temp.su sn=$sn  > temp1.su
susort tracf trid < temp1.su > data3c.su

# Remove temporary files:
rm -f temp.su temp1.su

exit 0
